<template>
	<view class="contain">
		<view class="u-demo-block__content rowstyle">
			<u-row justify="space-between" gutter="10">
				<u-col span="2">
					<view class="text-center blod">行为:</view>
				</u-col>
				<u-col span="4">
					<view class="text-center">{{userData.actionChinese}}</view>
				</u-col>
				<u-col span="2">
					<view class="text-center blod"></view>
				</u-col>
				<u-col span="4">
					<view class="text-center"></view>
				</u-col>
			</u-row>
		</view>
		<view class="u-demo-block__content rowstyle">
			<u-row justify="space-between" gutter="10">
				<u-col span="2">
					<view class="text-center blod">用户:</view>
				</u-col>
				<u-col span="4">
					<view class="text-center">{{userData.Name}}</view>
				</u-col>
				<u-col span="2">
					<view class="text-center blod">消费:</view>
				</u-col>
				<u-col span="4">
					<view class="text-center">{{userData.payMoney}}</view>
				</u-col>
			</u-row>
		</view>
		<view class="u-demo-block__content rowstyle">
			<u-row justify="space-between" gutter="10">
				<u-col span="2">
					<view class="text-center blod">商家:</view>
				</u-col>
				<u-col span="4">
					<view class="text-center">{{userData.merchant}}/{{userData.mrate}}</view>
				</u-col>
				<u-col span="2">
					<view class="text-center blod">返佣:</view>
				</u-col>
				<u-col span="4">
					<view class="text-center">{{userData.merchantRebate}}</view>
				</u-col>
			</u-row>
		</view>
		<view class="u-demo-block__content rowstyle">
			<u-row justify="space-between" gutter="10">
				<u-col span="2">
					<view class="text-center blod">推荐人:</view>
				</u-col>
				<u-col span="4">
					<view class="text-center">{{userData.personal}}/{{userData.prate}}</view>
				</u-col>
				<u-col span="2">
					<view class="text-center blod">返佣:</view>
				</u-col>
				<u-col span="4">
					<view class="text-center">{{userData.personalRebate}}</view>
				</u-col>
			</u-row>
		</view>
		<view class="u-demo-block__content rowstyle">
			<u-row justify="space-between" gutter="10">
				<u-col span="2">
					<view class="text-center blod">网红:</view>
				</u-col>
				<u-col span="4">
					<view class="text-center">{{userData.hot}}/{{userData.hrate}}</view>
				</u-col>
				<u-col span="2">
					<view class="text-center blod">返佣:</view>
				</u-col>
				<u-col span="4">
					<view class="text-center">{{userData.hotRebate}}</view>
				</u-col>
			</u-row>
		</view>
		<view class="flex justify-center items-center mt-3">
			<u-button type="primary" text="返回" @click="goBack"></u-button>
		</view>
		
		<view class="w-[100%] mt-5" style="border:1px solid lightgray; word-break: break-all;">{{tip}}</view>
		
	</view> <!-- contain -->
</template>


<script setup lang='ts'>

import { ref,reactive } from 'vue'
import {  onLoad,onShow } from '@dcloudio/uni-app'
import { userStore } from '@/stores/userStore'
const store = userStore()
let tip=ref('');
const goBack=()=>{
	uni.$tools.GoUrl("/pages/shop_set/shop_set",2);
}
let userData=reactive({
	bindType:null,
	action:null,
	actionChinese:"",
	Name:'', //用户
	payMoney:'', //支付金额
	merchant:'', //一级 XX蛋糕店
	mrate:0,
	merchantRebate:0, //一级返佣
	personal:'', //二级 Daniel
	prate:0,
	personalRebate:0, //二级返佣
	hot:'', //二级 Daniel
	hrate:0,
	hotRebate:0, //二级返佣
});

const toChinese=(action:string)=>{
	if(action==='p2p') return "个人推荐个人";
	if(action==='p2m') return "个人扫商家";
	if(action==='pp2m') return "个人推荐&成为商家会员";
	if(action==='h2p') return "网红推荐个人";
	if(action==='h2m') return "网红推荐商家";
	return action;
}

onShow(()=>{
	let result=uni.getStorageSync("result") || null;
	tip.value=result;
	if(result!=null){
		userData.actionChinese=toChinese(result.action);
		userData.Name=result.Name;
		userData.payMoney=result.payMoney;
		userData.merchant=result.merchant;
		userData.mrate=result.mrate;
		userData.merchantRebate=result.merchantRebate;
		userData.personal=result.personal;
		userData.prate=result.prate;
		userData.personalRebate=result.personalRebate;
		userData.hot=result.hot;
		userData.hrate=result.hrate;
		userData.hotRebate=result.hotRebate;
	}
});
</script>

<style lang='scss' scoped>
	@import "shop_result.scss";
</style>